package com.example.demo.service;

import com.example.demo.mapper.LogMapper;
import com.example.demo.model.LogInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Creat with IntelliJ IDEA
 * Description:
 * User:WZW
 * Date:2022-08-28
 * Time:20:49
 */
@Service
public class LogService {

    @Resource
    private LogMapper logMapper;

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public int add(LogInfo logInfo) {
        int result = logMapper.add(logInfo);
        System.out.println("添加日志结果：" + result);
        int num = 10 / 0;
        return result;
    }
}
